<?php

include_once __DIR__."/../vendor/autoload.php";

foreach(glob(__DIR__."/Services/*.php") as $serviceFile){
    include_once $serviceFile;
}

\asyncService\Bootstrap::newInstance(include __DIR__."/config.php");

$main = new \asyncService\mainService();

$main->registerService(\asyncTest\Services\DemoService::getInstance());
$main->registerService(\asyncTest\Services\Demo1Service::getInstance());

for($i = 1;$i<=106600;$i++){
    if(rand(0,1)){
        $a = \asyncTest\Services\DemoService::publish("123".$i);
    }else{
        $a = \asyncTest\Services\Demo1Service::publish("123".$i);
    }
    var_dump($a);

    /*if(rand(1,10) > 6){
        sleep(1);
    }*/
}

/*$mess = asyncService\message\messageFactory::Produce();
$a = $main->getServiceKey();
$mess->sendSignal($a);*/